from recruit.adapter.stubs import StubUserGateway
from recruit.application.protocols.interactor import Interactor
from recruit.domain.models.user import UserResult
from recruit.domain.models.user_id import UserTelegramId
from recruit.domain.services.user import UserService


class GetUser(Interactor[UserTelegramId, UserResult]):
    def __init__(
            self,
            user_db_gateway: StubUserGateway,
            user_service: UserService
    ) -> None:
        self.user_db_gateway = user_db_gateway
        self.user_service = user_service

    async def __call__(self, user_id: UserTelegramId) -> UserResult:
        user = await self.user_db_gateway.get_one(user_id=str(user_id))
        return self.user_service.get_user(user)
